package com.conph.student.intercepters;


import com.conph.moring.core.annotation.After;
import com.conph.moring.core.annotation.Aspect;
import com.conph.moring.core.annotation.Before;
import com.conph.student.action.StudentAction;
import com.conph.student.dao.StudentDao;
import com.conph.student.model.StudentModel;

@Aspect
public class StudentLogger {
	
	public StudentLogger() {
	}
	
	@Before(klass=StudentAction.class, method="getStudentById")
	public boolean beforeGetStudent(String id) {
		System.out.println("置前拦截到学号:" + id);
		
		return true;
	}
	
	@After(klass= StudentAction.class,
			method="getStudentById",
			parameterTypes= { String.class })
	public StudentModel afterGetStudent(StudentModel student) {
		System.out.println("后置拦截到学生信息:" + student);
		return student;
	}
	
	@Before(klass=StudentAction.class, method="getStudentById")
	public boolean getStudent(String id) {
		System.out.println("第二次前置拦截！");
		return true;
	}
	
	@Before(klass= StudentDao.class, method="getStudentById")
	public boolean beforeDao(String id) {
		System.out.println("对DAO的拦截:" + id);
		return true;
	}

}
